Skip to content

feat(agent-bundle): optional plugin.version with fail-closed releases and an agent-bundle/meta build-time constant - #270

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
feat/94-237-identity
Sep 2, 2026
Merged

feat(agent-bundle): optional plugin.version with fail-closed releases and an agent-bundle/meta build-time constant#270
ScriptedAlchemy merged 1 commit into
mainfrom
feat/94-237-identity

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Delivers #94 stage 3 and closes #237.

Optional plugin.version with package.json inference (#94 stage 3, #237a)

  • AgentBundlePluginConfig.version is optional. Omitted → the version is derived from package.json (the same axis snapshotPackageIdentity reads). Declared → the authored value still wins (legacy configs never change meaning) and a disagreement stays the AB4008 warning per Derive project identity from package version and compiler revisions #94's migration policy. Declared-but-invalid (empty/non-string) stays an AB4001 error with a message pointing at omission.

Fail-closed release semantics (#94 stage 3)

  • validateSource gains a release option; ProjectService.prepare('build') alone sets it, so agent-bundle build is exactly the release boundary. With no authored plugin.version and no valid package.json version, build fails closed with the new AB4013 error before anything compiles; dev/inspect/validate keep the documented labeled 0.0.0-dev.<short-revision> fallback.

Build-time identity constant (#237b)

  • New public subpath agent-bundle/meta exporting { name, version, packageName, packageVersion } (named constants + frozen aggregate). A package subpath rather than a scheme: id so types ship with the package export map and both bundler engines resolve it through one alias mechanism.
  • Injected uniformly as a generated virtual module: Rslib composition (every route/CLI/MCP/hook/script/package entry) and the Rsbuild MCP App builds (browser widget bundles), reserved against the tools escape hatch. Values are exactly what manifests/inspect/dev status report. Outside compilation the published module throws a named error (no TDZ trap).
  • examples/mcp-app now feeds new McpServer({ name, version }) from agent-bundle/meta; examples/audiobook-curator drops its restated plugin.version (the shim-deletion pattern from #237c).

Docs: new "Release identity" section in docs/diagnostics.md (AB4001, AB4008–AB4011, AB4013 — AB4012 was taken by plugin.logo in #267, so the fail-closed code landed as AB4013) and an agent-bundle/meta section in docs/entry-conventions.md. Changeset: agent-bundle minor.

Test plan

… build-time identity

Make `plugin.version` optional (#94 stage 3, #237): package.json is the one
version source, and normalization derives the plugin version from it when the
config omits the field. A declared value that is not a nonempty string is
still AB4001, and one that disagrees with package.json is still the AB4008
warning, so a legacy declaration never changes meaning mid-migration.

Fail release builds closed (#94 stage 3): `agent-bundle build` is the only
command that produces a release artifact, so it alone refuses a project with
neither an authored plugin.version nor a valid package.json version, with the
new AB4012 error. Development commands keep the labeled 0.0.0-dev fallback,
which can therefore never reach a release artifact.

Add the `agent-bundle/meta` build-time identity module (#237): every compiled
plugin surface — script, CLI, MCP entry, hook, and package bundles through
Rslib plus browser MCP App bundles through Rsbuild — resolves it to the exact
{ name, version, packageName, packageVersion } that manifests, `inspect`, and
dev status report, so plugins can delete hand-written version shims. It is a
real package subpath, so types ship with the export and no generated
declaration is involved; it is a reserved specifier the tools hatch cannot
externalize; and outside Agent Bundle compilation it throws rather than
reporting a fabricated identity.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b17c75a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy merged commit 09067f6 into main Sep 2, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T03:27:33.137152Z b17c75a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infer plugin version from package.json and expose a build-time version constant to plugin code

1 participant